﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VonaJobs.DAL.DAO;
using VonaJobs.DAL.Gatway;

namespace VonaJobs.BLL
{
    public class AdminRoleManager
    {
        AdminRoleGateway adminRoleGateway=new AdminRoleGateway();
        public string SaveNewRole(AdminRole adminRole)
        {
            try
            {
                if (!IsThisRoleExist(adminRole))
                {
                    return adminRoleGateway.SaveRole(adminRole);
                }
              
            }
            catch (Exception)
            {
                
                throw;
            }
            return "Save new role successfully";
        }

        private bool IsThisRoleExist(AdminRole adminRole)
        {
            try
            {
                return adminRoleGateway.IsThisRoleExist(adminRole);
            }
            catch (Exception)
            {
                
                throw;
            }
        }
        public string UpdateRole(AdminRole adminRole)
        {
            try
            {
                return adminRoleGateway.UpdateRole(adminRole);
            }
            catch (Exception)
            {
                
                throw;
            }
        }
    }
}